class LoadingUI extends egret.Sprite {

    public loading_bg: egret.Bitmap;
    public loadingMask:egret.Bitmap;
    public loading:egret.Bitmap;
    public mainContainer:egret.DisplayObjectContainer;

    public constructor() {
        super();
        this.createView();
    }



    private createView(): void {
        this.mainContainer=new egret.DisplayObjectContainer();
        this.addChild(this.mainContainer);
        this.loading_bg = new egret.Bitmap(RES.getRes("loading_bg_png"));
        this.loading_bg.x = 65;
        this.loading_bg.y = 0;
        this.mainContainer.addChild(this.loading_bg);

        this.loadingMask = new egret.Bitmap(RES.getRes("loading_png"));
        this.loadingMask.x = 112;
        this.loadingMask.y = 13;
        this.loadingMask.width=0;
        this.mainContainer.addChild(this.loadingMask);

        this.loading = new egret.Bitmap(RES.getRes("loading_png"));
        this.loading.x = 112;
        this.loading.y = 13;
        this.mainContainer.addChild(this.loading);
        this.loading.mask=this.loadingMask;

        this.mainContainer.y=(utils.CoreData.instance.screenH-this.mainContainer.height)/2;
    }

    public setProgress(current, total): void {
        this.loadingMask.width=this.loading.width*current / total;
    }
}
